using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Konst3d.Efficiency.Suite;

namespace PEM
{
	/// <summary>
	/// Interaction logic for CreateEditMonitoDialog.xaml
	/// </summary>
	public partial class CreateEditMonitoDialog : PersistentModalDialog
	{
		public string MonitorTitle
		{
			get
			{
				return uiMonitorTitleTextBox.Text;
			}
		}

		public string MonitorDescription
		{
			get
			{
				return uiMonitorDescriptionTextBox.Text;
			}
		}

		public CreateEditMonitoDialog()
		{
			InitializeComponent();
		}

		public bool[] GetActiveWeekDays()
		{
			return new bool[]{uiMonitorActiveDayMonday.IsChecked ?? false,
				uiMonitorActiveDayTuesday.IsChecked ?? false,
				uiMonitorActiveDayWednesday.IsChecked ?? false,
				uiMonitorActiveDayThursday.IsChecked ?? false,
				uiMonitorActiveDayFriday.IsChecked ?? false,
				uiMonitorActiveDaySaturday.IsChecked ?? false,
				uiMonitorActiveDaySunday.IsChecked ?? false};
		}

		public bool ShowDialog(Window owner, IMonitor monitor)
		{
			uiMonitorTitleTextBox.Text = monitor.Title;
			uiMonitorDescriptionTextBox.Text = monitor.Description;
			uiMonitorActiveDayMonday.IsChecked = monitor.ActiveDays.DaysOfWeek[0];
			uiMonitorActiveDayTuesday.IsChecked = monitor.ActiveDays.DaysOfWeek[1];
			uiMonitorActiveDayWednesday.IsChecked = monitor.ActiveDays.DaysOfWeek[2];
			uiMonitorActiveDayThursday.IsChecked = monitor.ActiveDays.DaysOfWeek[3];
			uiMonitorActiveDayFriday.IsChecked = monitor.ActiveDays.DaysOfWeek[4];
			uiMonitorActiveDaySaturday.IsChecked = monitor.ActiveDays.DaysOfWeek[5];
			uiMonitorActiveDaySunday.IsChecked = monitor.ActiveDays.DaysOfWeek[6];

			return ShowDialog(owner);
		}

		private void OnCreateButtonClick(object sender, RoutedEventArgs e)
		{
			DialogResult = true;
		}

		private void OnCancelButtonClick(object sender, RoutedEventArgs e)
		{
			DialogResult = false;
		}
	}
}
